<?php include './application/views/common/zhs_header.php';?>

<!-- center部分 -->
<?php include './application/views/common/zhs_usercenter_acnt.php';?>
<div class="inv_box w">
<?php include './application/views/common/zhs_usercenter_left.php';?>

  <div class="membd_right" style="margin-top:0;">
  <?php if($type == 3){?>
   <form id="collForm" action="/userborrow/zhs_coll.html" method="get">
    <div class="memhktitle mt"><h3 class="memhk_h3">待回款：
		  	开始时间：<input type="text" id="strtime" name="strtime" style="width: 100px; height:20px;" value="<?php echo $where['strtime'];?>"  onfocus="WdatePicker()" readonly="readonly"/>
			结束时间：<input type="text" id="endtime" name="endtime" style="width: 100px; height:20px;" value="<?php echo $where['endtime'];?>"  onfocus="WdatePicker()" readonly="readonly"/>
			<a href="javascript:void(0)" onclick="document.getElementById('collForm').submit();">&nbsp;&nbsp;查询</a>
			<!--<a href="/userborrow/coll.html?act=excel&strtime=<?php echo $where['strtime'];?>&endtime=<?php echo $where['endtime'];?>">导出</a>
			-->
	</h3>
    <span> <a href="/userborrow/zhs_ycoll.html">去查已收回款</a></span></div>
    </form>
    <?php } else{?>
       <form id="collForm" action="/userborrow/zhs_ycoll.html" method="get">
    <div class="memhktitle mt"><h3 class="memhk_h3">已回款：
		  	开始时间：<input type="text" id="strtime" name="strtime" style="width: 100px; height:20px;" value="<?php echo $where['strtime'];?>"  onfocus="WdatePicker()" readonly="readonly"/>
			结束时间：<input type="text" id="endtime" name="endtime" style="width: 100px; height:20px;" value="<?php echo $where['endtime'];?>"  onfocus="WdatePicker()" readonly="readonly"/>
			<a href="javascript:void(0)" onclick="document.getElementById('collForm').submit();">&nbsp;&nbsp;查询</a>
			<!--<a href="/userborrow/coll.html?act=excel&strtime=<?php echo $where['strtime'];?>&endtime=<?php echo $where['endtime'];?>">导出</a>
			-->
	</h3>
    <span> <a href="/userborrow/zhs_coll.html">去查待收回款</a></span></div>
    </form>
    <?php }?>
    <div class="hk_body pt">
        <table class="membd_tab">
			<thead>
				<tr>
					<th width="90">标题</th>
					<th width="90">期数/总期数</th>
					<?php if($type == 4){?>
					<th width="90">收款时间</th>
					<th width="90">已收本金</th>
					<th width="90">已收利息</th>
					<th width="90">本息合计</th>
					<?php }else{?>
					<th width="90">应收时间</th>
					<th width="90">应收本金</th>
					<th width="90">应收利息</th>
					<th width="90">本息合计</th>
					<?php }?>
					<?php if($type == 3){?>
					<th width="90">逾期时间</th>
					<th width="90">逾期费用</th>
					<?php }elseif($type == 4){?>
					<th width="90">逾期时间</th>
					<th width="90">逾期费用</th>
						<?php }?>
				</tr>
			</thead>
      		<tbody>
        		<?php foreach($collection_list as $col){?>
		  		<tr>
		 			<td><a href="/borrow/zhs_obj/<?php echo $col['borrow_id'];?>.html"><?php echo CON_NAME;?>-<?php echo $borrow_type[$col['ftype']].$col['borrow_id'];?></a></td>			
					<td align="center"><?php echo $col['forder']+1;?>/<?php if(3== $col['style']) echo 1 ;else echo $col['time_limit'];?></td>
					<?php if($type == 4){?>
					<td><?php echo date('Y-m-d',$col['repay_yestime']);?></td>
					<td>&yen;<?php echo number_format($col['capital'],2);?> </td>
					<td>&yen;<?php echo number_format($col['interest'],2);?> </td>
					<td>&yen;<?php echo number_format($col['interest'],2)+number_format($col['capital'],2);;?> </td>
					<?php }else{?>
					<td><?php echo date('Y-m-d',$col['repay_time']);?></td>
					<td>&yen;<?php echo number_format($col['capital'],2);?> </td>
					<td align="center">&yen;<?php echo number_format($col['interest'],2);?> </td>
					<td>&yen;<?php echo number_format($col['interest'],2)+number_format($col['capital'],2);;?> </td>
					<?php }?>
			
			<?php if( 1==$col['ftype'] ){?>
				<?php if($type == 3){?>
				<?php $late_result = late_interest($col['repay_time'], $col['capital']>0?$col['capital']:$col['interest']);?>
				<td><?php echo $late_result['late_days'];?>天</td>
				<td>&yen; 0 </td>
				<?php }elseif ($type == 4){?>
				<td><?php echo $col['late_days'];?>天</td>
				<td>&yen; 0 </td>
				<?php }?>
		   <?php }elseif( 2==$col['ftype'] ){?>
		 	 	<?php if($type == 3){?>
				<?php $late_result = late_interest($col['repay_time'], $col['capital']>0?$col['capital']:$col['interest']);?>
				<td><?php echo $late_result['late_days'];?>天</td>
				<td>&yen; <?php echo $col['late_days'];?> </td>
				<?php }elseif ($type == 4){?>
				<td><?php echo $col['late_days'];?>天</td>
				<td>&yen; <?php echo $col['late_interest'];?></td>
				<?php }?>
		   <?php }elseif( 3==$col['ftype'] ){?>
		  		<?php if($type == 3){?>
				<?php $late_result = late_interest($col['repay_time'], $col['capital']>0?$col['capital']:$col['interest']);?>
				<td><?php echo $late_result['late_days'];?>天</td>
				<td>&yen; 0 </td>
				<?php }elseif ($type == 4){?>
				<td><?php echo $col['late_days'];?>天</td>
				<td>&yen; 0 </td>
				<?php }?>
		   <?php }?> 

		  </tr>
		  <?php }?>
      </tbody>
    </table>
    <div class="invbd_page"><?php echo $this->pagination->create_links();?></div>
  </div>
</div> 
</div>

<?php include './application/views/common/zhs_footer.php';?>

<?php include './application/views/common/zhs_right.php';?>